package com.samphanie.auiu.admin.config;

import com.samphanie.auiu.common.config.BaseRedisConfig;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
@Configuration
public class MyRedisConfig extends BaseRedisConfig {

    /**
     * redisson 配置
     */
    @Bean(destroyMethod="shutdown")
    public RedissonClient redisson() throws IOException {
        // 1.创建配置
        Config config = new Config();
        //        config.useClusterServers()
        //                .addNodeAddress("127.0.0.1:7004", "127.0.0.1:7001");
        config.useSingleServer().setAddress("redis://47.100.74.170:6379").setPassword("Zxx131013@");
        // 2.根据Config 创建出RedissonClient
        return Redisson.create(config);
    }


}
